package com.csproj.dispatch.service.dto;


import com.csproj.dispatch.util.DateJsonDeserializer;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;
import java.util.Set;

/**
 * A DTO for the ProductInfo entity.
 */
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class ProductInfoDTO implements Serializable {

    private String id;

    private String customCode;

    private String containerId;

    private String containerCode;

    private String despachante;

    private Integer ctn;

    private String packagekind;

    private String du;

    private Double pesobruto;

    private Double pesoquido;

    private String rdia;

    private Boolean deletedFlag;

    private String deleterUserId;
    @JsonDeserialize(using = DateJsonDeserializer.class)
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime deletionTime;
    @JsonDeserialize(using = DateJsonDeserializer.class)
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime lastModificationTime;

    private String lastModifierUserId;
    @JsonDeserialize(using = DateJsonDeserializer.class)
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime creationTime;

    private String creatorUserId;

    //补充- 货物明细
    private Set<ProductDetailInfoDTO> productDetailInfoDTOS;

    public Set<ProductDetailInfoDTO> getProductDetailInfoDTOS() {
        return productDetailInfoDTOS;
    }

    public void setProductDetailInfoDTOS(Set<ProductDetailInfoDTO> productDetailInfoDTOS) {
        this.productDetailInfoDTOS = productDetailInfoDTOS;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCustomCode() {
        return customCode;
    }

    public void setCustomCode(String customCode) {
        this.customCode = customCode;
    }

    public String getContainerId() {
        return containerId;
    }

    public void setContainerId(String containerId) {
        this.containerId = containerId;
    }

    public String getContainerCode() {
        return containerCode;
    }

    public void setContainerCode(String containerCode) {
        this.containerCode = containerCode;
    }

    public String getDespachante() {
        return despachante;
    }

    public void setDespachante(String despachante) {
        this.despachante = despachante;
    }

    public Integer getCtn() {
        return ctn;
    }

    public void setCtn(Integer ctn) {
        this.ctn = ctn;
    }

    public String getPackagekind() {
        return packagekind;
    }

    public void setPackagekind(String packagekind) {
        this.packagekind = packagekind;
    }

    public String getDu() {
        return du;
    }

    public void setDu(String du) {
        this.du = du;
    }

    public Double getPesobruto() {
        return pesobruto;
    }

    public void setPesobruto(Double pesobruto) {
        this.pesobruto = pesobruto;
    }

    public Double getPesoquido() {
        return pesoquido;
    }

    public void setPesoquido(Double pesoquido) {
        this.pesoquido = pesoquido;
    }

    public String getRdia() {
        return rdia;
    }

    public void setRdia(String rdia) {
        this.rdia = rdia;
    }

    public Boolean isDeletedFlag() {
        return deletedFlag;
    }

    public void setDeletedFlag(Boolean deletedFlag) {
        this.deletedFlag = deletedFlag;
    }

    public String getDeleterUserId() {
        return deleterUserId;
    }

    public void setDeleterUserId(String deleterUserId) {
        this.deleterUserId = deleterUserId;
    }

    public ZonedDateTime getDeletionTime() {
        return deletionTime;
    }

    public void setDeletionTime(ZonedDateTime deletionTime) {
        this.deletionTime = deletionTime;
    }

    public ZonedDateTime getLastModificationTime() {
        return lastModificationTime;
    }

    public void setLastModificationTime(ZonedDateTime lastModificationTime) {
        this.lastModificationTime = lastModificationTime;
    }

    public String getLastModifierUserId() {
        return lastModifierUserId;
    }

    public void setLastModifierUserId(String lastModifierUserId) {
        this.lastModifierUserId = lastModifierUserId;
    }

    public ZonedDateTime getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(ZonedDateTime creationTime) {
        this.creationTime = creationTime;
    }

    public String getCreatorUserId() {
        return creatorUserId;
    }

    public void setCreatorUserId(String creatorUserId) {
        this.creatorUserId = creatorUserId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        ProductInfoDTO productInfoDTO = (ProductInfoDTO) o;
        if(productInfoDTO.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), productInfoDTO.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "ProductInfoDTO{" +
            "id=" + getId() +
            ", customCode='" + getCustomCode() + "'" +
            ", containerCode='" + getContainerCode() + "'" +
            ", despachante='" + getDespachante() + "'" +
            ", ctn=" + getCtn() +
            ", packagekind='" + getPackagekind() + "'" +
            ", du='" + getDu() + "'" +
            ", pesobruto=" + getPesobruto() +
            ", pesoquido=" + getPesoquido() +
            ", rdia='" + getRdia() + "'" +
            ", deletedFlag='" + isDeletedFlag() + "'" +
            ", deleterUserId='" + getDeleterUserId() + "'" +
            ", deletionTime='" + getDeletionTime() + "'" +
            ", lastModificationTime='" + getLastModificationTime() + "'" +
            ", lastModifierUserId='" + getLastModifierUserId() + "'" +
            ", creationTime='" + getCreationTime() + "'" +
            ", creatorUserId='" + getCreatorUserId() + "'" +
            "}";
    }
}
